package com.springboot.cloud.client.provider;

import com.springboot.cloud.core.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * <p>  调用认证接口，进行认证 </p>
 *
 * @author Bertram
 * @since 11/7/2019 3:27 PM
 */
@FeignClient(name = "authentication-server", fallback = AuthProviderFallback.class)
public interface AuthProvider {

    /**
     * 调用签权服务，判断用户是否有权限
     *
     * @param authentication
     * @param url
     * @param method
     * @return
     */
    @PostMapping(value = "/auth/permission")
    Result auth(@RequestHeader(HttpHeaders.AUTHORIZATION) String authentication,
                @RequestParam("url") String url, @RequestParam("method") String method);

}
